<html>
<head><meta charset="utf-8"><title>generate test stub · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html">generate test stub</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="245603742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/generate%20test%20stub/near/245603742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html#245603742">(Jul 11 2021 at 12:03)</a>:</h4>
<p>Hello hi! <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span><br>
Just opened <a href="https://github.com/rust-analyzer/rust-analyzer/issues/9566">https://github.com/rust-analyzer/rust-analyzer/issues/9566</a> <br>
Happy to discuss more either on the issue or here on Zulip or Discord or elsewhere. I haven't contributed to <code>rust-analyzer</code> codebase  yet but could try to help with this in case someone can show me towards the right directions!</p>



<a name="245609775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/generate%20test%20stub/near/245609775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html#245609775">(Jul 11 2021 at 14:31)</a>:</h4>
<p>You probably want to look at the <code>generate_*</code> assists here <a href="https://github.com/rust-analyzer/rust-analyzer/tree/master/crates/ide_assists/src/handlers">https://github.com/rust-analyzer/rust-analyzer/tree/master/crates/ide_assists/src/handlers</a></p>



<a name="245609780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/generate%20test%20stub/near/245609780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html#245609780">(Jul 11 2021 at 14:31)</a>:</h4>
<p>as well as <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_function.rs">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_function.rs</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs</a></p>



<a name="245609792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/generate%20test%20stub/near/245609792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html#245609792">(Jul 11 2021 at 14:31)</a>:</h4>
<p>those should have some stuff that overlaps with the assist idea I think</p>



<a name="245610015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/generate%20test%20stub/near/245610015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html#245610015">(Jul 11 2021 at 14:36)</a>:</h4>
<p>Hm, I have certain doubts whether this'll be generally applicable.... Only part of the tests in the wild exercise API calls directly, and most of such calls require application specific setup.</p>
<p>I wonder, if theres's some way to solve the underlying problem without hard-coding a specific template? I imagine that, in the ideal world, you'd be able to just more or less auto-compete your way through the steup code</p>



<a name="245613754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/generate%20test%20stub/near/245613754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Walther <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/generate.20test.20stub.html#245613754">(Jul 11 2021 at 16:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/generate.20test.20stub/near/245610015">said</a>:</p>
<blockquote>
<p>Only part of the tests in the wild exercise API calls directly, and most of such calls require application specific setup.</p>
</blockquote>
<p>I was thinking more in terms of unit tests on library code, not necessarily for end-to-end tests in application code - if that makes more sense</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>